function snapshot_apply (
	[int] $scenario,  #scenario 0..#s-1
	[int] $computer #ordinateur 0..#c-1
) { 
	$VMServer = $CONFIG_SERVERS[$computer]
	$sujet = $sujets[$scenario]
	
	# recherche des vms
	if(($vms_wmi = (get-vmwmi $vmServer $sujet))) {
		foreach($vm_wmi in $vms_wmi) {
			if($vm_wmi.State -ne "Stopped") {
				# application des snapshots
				write-host (" Applying NEWEST snapshot on "+($vm_wmi.Path.Server)+"\"+($vm_wmi.ElementName)) -foregroundcolor yellow
				Get-VMSnapshot -VM $vm_wmi -newest | Apply-Snapshot -force
			} else {
				# message erreur
				write-host "ERROR: $vm_wmi.ElementName is not stopped. It is not possible to apply a snapshot. Please turn it off first. " -foregroundcolor red
			}
		}
	}
}

$actions.Insert($actions.Count,"snapshot_apply");
set-variable LANG_ACTION__SNAPSHOT_APPLY "APPLIQUER le dernier snapshot" -scope global
